<%@tag pageEncoding="UTF-8" body-content="empty"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@attribute name="lista" required="true" type="java.util.List" %>
<%@attribute name="label" required="true" %>
<%@attribute name="nome" required="true" %>
<%@attribute name="select" required="false" type="java.lang.Boolean"%>
<%@attribute name="idSelect" required="false" type="java.lang.Integer"%>

<label for="${nome}">${label}</label>
<select id="${nome}" name="${nome}">
    <c:forEach var="elemento" items="${lista}" > 
        <option value=${elemento.id}
				<c:if test="${select and idSelect == elemento.id}">
					<c:out value="selected='selected'"/>
				</c:if> 
			>${elemento}</option>        
    </c:forEach>
</select>